<template>
	<view class="" v-if="pageShow">
		<!--未交保证金的状态-->
		<view class="wjbox" v-if="Number(userInfo.xb_bzj_price)-Number(userInfo.bzj_price)>0">
			<view class="flexleft">
				<u-icon name="warning-fill" color="#FFFFFF" size="26"></u-icon>
				<view class="ershib xiaobai fonweight margin_left1">保证金未缴纳</view>
			</view>
			<view class="strongtext xiaobai margin_top1">请及时缴纳保证金，未缴纳保证金不能发布胆码！</view>
		</view>
		<!-- 已交保证金的状态 -->
		<view class="yjbox"v-else>
			<view class="flexleft">
				<u-icon name="checkmark-circle-fill" color="#FFFFFF" size="26"></u-icon>
				<view class="ershib xiaobai fonweight margin_left1">保证金已缴纳</view>
			</view>
			<view class="strongtext xiaobai margin_top1">您已缴纳保证金，祝您的业绩日上层楼！</view>
		</view>
		<view class="ffffff mainpadding margin_top">
			<view class="ershiba xiaohei textcenter">保证金当前余额(元)</view>
			<view class=" fonweight textcenter xiaohuang" style="font-size: 70rpx;">{{userInfo.bzj_price}}</view>
			<!--未交保证金的时候需要展示-->
			<view class="huibox mainpadding flexbetween margin_top" v-if="Number(userInfo.xb_bzj_price)-Number(userInfo.bzj_price)>0">
				<view class="titletext xiaohei">待补缴保证金</view>
				<view class="sishi fonweight xiaocheng">{{Number(userInfo.xb_bzj_price)-Number(userInfo.bzj_price)}}</view>
			</view>
			<view class="flexbetween margin_top" v-if="Number(userInfo.xb_bzj_price)-Number(userInfo.bzj_price)>0">
				<view class="txxbtn flexcenter" @click="jumpurl('/pages_mypage/tixian?type=2')">提现</view>
				<view class="ljbtn flexcenter" @click="bujiao">立即补缴</view>
			</view>
			<view class="margin_top" v-else>
				<view class="txdbtn flexcenter" @click="jumpurl('/pages_mypage/tixian?type=2')">提现</view>
			</view>
		</view>
		<view class="mainpadding">
			<view class="dingwei">
				<view class="sanshier fonweight zhonghei">保证金明细</view>
				<image class="xiahx" src="@/static/images/system/ztxhx.png" mode=""></image>
			</view>
			<view class="flexcolumn" v-if="list.data.length==0">
				<view class="placeholderimage" style="margin-top: 200rpx;"></view>
				<view class="xiaohui margin_top main_size">暂无数据</view>
			</view>
			<view class="mainpadding ffffff radius margin_top"  v-if="list.total">
				<view class="shangbj flexbetween xiahuaxian" v-for="item in list.data" :key="item.id">
					<view class="">
						<view class="ershiba fonweight zhonghei">{{item.memo}}</view>
						<view class="strongtext margin_top1 xiaohui">{{item.createtime_text}}</view>
					</view>
					<view class="flexright">
						<view class="sanshier fonweight" style="color:#2d9070;">{{item.money}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				userInfo: {},
				page: 1,
				limit: 12,
				list: {
					data: []
				},
				pageShow: false,
			}
		},
		onShow() {
			this.userinfomsg()
			this.init()
		},
		methods: {
			
			init(isPage, page) {
				let _this = this
				let url = "/api/user/userBzjLogIndex"
				let data = {
					page: page || 1,
					limit: _this.limit,
				}
				httpRequest.request(url, 'GET', data, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			userinfomsg() {
				httpRequest.request('/api/user/index', 'GET', {
				}).then(res => {
					this.userInfo = res.data
					this.pageShow = true
				})
			},
			bujiao(){
				let data = {
					pay_price:Number(this.userInfo.xb_bzj_price)-Number(this.userInfo.bzj_price),
					type:2,
					order_id:""
				}
				uni.navigateTo({
					url:"/pages_index/zhifu?msg="+ encodeURIComponent(JSON.stringify(data))
				})
			}
		}
	}
</script>
<style lang="scss" scoped>
	.quedbtn1 {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 321rpx;
		height: 82rpx;
		font-size: 32rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		color: #fff;
		border: 2rpx solid #FF9341;
		background-color: #FF9341;
		border-radius: 41rpx;
	}

	.chonzbtn {
		border-radius: 41rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 321rpx;
		height: 82rpx;
		font-size: 32rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		color: #FF9341;
		border: 2rpx solid #FF9341;
		background-color: #fff;
	}

	.chanpinse {
		font-size: 32rpx;
		font-family: DIN Next LT Pro-Bold, DIN Next LT Pro;
		font-weight: bold;
		color: #FAB536;
	}

	.kym {
		margin: 250rpx auto 0;
		width: 343rpx;
		height: 324rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.xian {
		width: 22rpx;
		height: 0rpx;
		background-color: #999999;
		border: 1rpx solid #999999;
	}

	.shijianbtn {
		padding: 20rpx 65rpx;
		background: #F7F9FA;
		border-radius: 41rpx;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
	}

	.huisebtn {
		width: 198rpx;
		height: 80rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
		background: #F7F9FA;
		border-radius: 41rpx;
	}

	.haungsebtn {
		width: 198rpx;
		height: 80rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #EF8933;
		background: rgba(239, 137, 51, .1);
		border-radius: 41rpx;
	}

	.sanshi {
		width: 33.33%;
	}
</style>
<style lang="scss" scoped>
	.xiahuaxian:last-child {
		padding-bottom: 0;
		border: none;
	}

	.shangbj {
		margin-top: 30rpx;
	}

	.shangbj:first-child {
		margin-top: 0rpx;
	}

	.xiahx {
		width: 124rpx;
		height: 10rpx;
		position: absolute;
		bottom: 0;
		left: 0;
	}

	.txdbtn {
		width: 100%;
		height: 75rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		font-size: 28rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		color: #ff8506;
		border: 2rpx solid #ff8506;
	}

	.ljbtn {
		width: 337rpx;
		height: 75rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		font-size: 28rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		background-color: #ff8506;
		border: 2rpx solid #ff8506;
	}

	.txxbtn {
		width: 337rpx;
		height: 75rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		font-size: 28rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		color:#ff8506;
		border: 2rpx solid #ff8506;
	}

	.huibox {
		background: #F5F5F5;
		border-radius: 11rpx 11rpx 11rpx 11rpx;
	}

	.yjbox {
		padding: 20rpx 30rpx;
		background: linear-gradient(118deg, #75D3B5 0%, #2D9070 100%);
	}

	.wjbox {
		padding: 20rpx 30rpx;
		background: linear-gradient(118deg, #FCBB65 0%, #FA8336 100%);
	}
</style>